package com.seh.contentcenter.utils;

import com.seh.contentcenter.domain.Result;

public class ResultUtil {
    public static<T> Result success(String code, String msg, T data) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static<T> Result success(T data) {
        Result result = success("100", "成功", data);
        return result;
    }

    public static <T> Result userInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result userInfo(T data){
        Result result = userInfo("200","用户信息", data);
        return result;
    }
    public static <T> Result postInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result postInfo(T data){
        Result result = postInfo("300","帖子信息", data);
        return result;
    }
    public static <T> Result addressInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result addressInfo(T data){
        Result result = addressInfo("400","地址信息", data);
        return result;
    }

    public static <T> Result deliverInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result deliverInfo(T data){
        Result result = deliverInfo("500","代取信息", data);
        return result;
    }

    public static <T> Result orderInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result orderInfo(T data){
        Result result = orderInfo("600","订单信息", data);
        return result;
    }

    public static <T> Result managerInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result managerInfo(T data){
        Result result = managerInfo("700","管理员信息", data);
        return result;
    }
    public static <T> Result goodsInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result goodsInfo(T data){
        Result result = goodsInfo("800","商品信息", data);
        return result;
    }

    public static <T> Result replyInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result replyInfo(T data){
        Result result = replyInfo("868","回帖信息", data);
        return result;
    }

    public static <T> Result commentInfo(String code, String msg,T data){
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }
    public static <T> Result commentInfo(T data){
        Result result = commentInfo("1000","回帖信息", data);
        return result;
    }

    public static<T> Result error(String code, String msg, T data) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        result.setData(data);
        return result;
    }

    public static<T> Result error(T data) {
        Result result = error("04040", "失败", data);
        return result;
    }

}










